home *** CD-ROM | disk | FTP | other *** search
-
-
-
-
- BU - Batch Utility V4.00
-
- Copyright (c) 1987-1995 by Danen Information Services
- All Rights Reserved
-
-
-
-
- This program may be distributed freely, as long as no money is
- charged. The program and documentation may not be modified
- without the author's permission.
-
-
-
-
- DISCLAIMER
-
- This program is distributed "as is." The author makes no
- claims as to the suitability of this program, nor is he
- responsible for losses due to misuse or abuse of the program.
- The user assumes all responsibility for determining if this
- program is suitable for his purposes.
-
-
-
- Introduction
-
-
- The purpose of this program is to enhance the use of MS-DOS batch files.
-
- "BU" replaces a number of separate utility programs, such as: ASK, CRLF,
- CURSOR, HEADER, HITENTER, MSG, REDALERT, SOUND, TIMER, WARBLE, and YN. It also
- adds functions not found in those older programs.
-
- There are several reasons to combine all these functions into one program.
- First of all, the individual functions have been standardized. Secondly, you
- will save disk space by using only one program. Thirdly, the sound functions
- are adapted to the speed of your processor.
-
- The syntax for the program is simple. The very first letter on the command
- line is the key code. This code may be followed by a "clear screen indicator"
- which clears the screen before the requested function is executed.
-
- Then, optional arguments follow which are applicable to the requested function.
- For example, the "header" function takes the rest of the command line and
- displays it in a box on the screen, and the "sound" function looks at the first
- letter of the rest of the command line to determine which sound to produce.
-
- If you don't like the noises, set the environment variable GD.SOUND to OFF:
-
- SET GD.SOUND=OFF
-
- Key Codes
-
- P - Pause, wait for [Enter] 1)
- C - Enter Character 1)
- Y - Enter Y or N 1)
- D - Dump File to Screen
- F - Display File
- H - Display Header 1)
- M - Display Message 1) 2)
- B - Display Blank Line 2)
- T - Display Day, Date, and Time 2)
- S - Sound 3)
- W - Wait for a number of Seconds
- ^ - Clear the Screen, DOS CLS replacement
- _ - Set Cursor to Normal, Big, or Hidden
-
- All codes may be followed by ^, which will clear the screen first, e.g. P^,
- Y^, etc. Code H and H^ work the same, and so do ^ and ^^.
-
- 1) These codes may be followed by a message to be displayed.
-
- 2) These functions use DOS for the display, so the information may be
- redirected to a file or printer. If you have used ANSI.SYS to set
- colours, these three functions will display text in those colours.
-
- 3) Follow this code by B(eep), G(lissando), N(oise), P(hone), R(ed
- Alert), or W(arble).
-
- Examples of all codes are found in BU-DEMO.BAT.
-
-
- PAUSE:
-
- Key code P or P^. Acts as a replacement for the DOS PAUSE command. The DOS
- command asks to strike "any" key when ready. That can cause problems if you
- accidentally hit a key. For example, you ask the user to insert a new disk in
- drive A: and use the DOS PAUSE command. If the user, by reaching for the disk
- happens to hit the space bar, disastrous things could happen. BU's PAUSE only
- accepts the [Enter] key, which is less likely to be hit by accident.
-
- The optional message is displayed, followed by:
-
- Press the [Enter] key to continue, or [Ctrl]/[Break] to abort...
-
-
- ENTER CHARACTER:
-
- Key code C or C^. This function waits for the user to enter a keystroke, and
- sets an errorlevel code which can be examined in the batch file. There are two
- modes of operation for this function, one where ANY key is accepted, and one
- where only valid characters are accepted. All lowercase letters are converted
- to uppercase letters, regardless of processing mode.
-
- If the rest of command line starts with a "{" then the program assumes that a
- list of accep- table characters follows, terminated with a "}". If such a list
- is given, then only a character from the list is allowed to be entered, and an
- errorlevel is returned corresponding to the position in the list. For example,
- if {ABC} is the given list, and the "B" was entered, errorlevel 2 is returned.
- In order for this procedure to work properly, all characters given must be
- unique. If {abcA} is handed to the program, it will never return errorlevel 4!
-
- A second "{}" string may be included, to indicate a default response, and how
- many seconds to wait before this default is assumed to have been type. This
- can be very useful for unattended AUTOEXEC.BAT files of a BBS computer, or a
- file server, where the computer can load the required programs after a power
- outage, for example. Syntax of this string is "{k:secs}", where "k" is the
- default key, and "secs" is the number of seconds to wait. See BU-DEMO.BAT for
- an example.
-
- If no list is given, then the ASCII value of the character is returned in the
- errorlevel. If a "Q" is entered, the errorlevel is set to 81.
-
- Example of using a list of valid characters:
-
- :menu
- bu h Menu to test sounds:
- echo Red Alert
- echo Warble
- echo Quit
- bu c {rwq} Select an option
- if errorlevel 3 goto m-end
- if errorlevel 2 goto m-2
- if errorlevel 1 goto m-1
- bu p Should never get here!
- :m-1
- bu s Red
- goto menu
- :m-2
- bu s Warble
- goto menu
- :m-end
-
- Example of using ASCII codes:
-
- :menu
- bu h Menu to test sounds:
- echo Red Alert
- echo Warble
- echo Quit
- bu c Select an option
- rem R=82, W=87, Q=81 --- this is compatible with the old ASK program!
- if errorlevel 88 goto menu
- if errorlevel 87 goto m-2
- if errorlevel 83 goto menu
- if errorlevel 82 goto m-1
- if errorlevel 81 goto m-end
- goto menu
- :m-1
- bu s Red
- goto menu
- :m-2
- bu s Warble
- goto menu
- :m-end
-
-
- ENTER YES OR NO:
-
- Key code Y or Y^. This function works much like the "enter character" function
- with a list option of {YN}. This function accepts a default value as {?},
- where ? is a Y or N. Pressing [Enter] causes the default value to be assumed
- as entered. The only other characters the program will accept are "Y" and "N".
- Errorlevel 1 is returned for a YES response, a 0 for a NO response.
-
- The default {Y} or {N} may also include a number of seconds before this default
- response is used. See "Enter Character" for more information, and check
- BU-DEMO.BAT for an example.
-
- Example:
-
- rem A default response of "Y" is assumed.
- bu y {y} Do you want to continue
- if errorlevel 1 goto yes_opt
- echo Processing NO option
- goto contin
- :yes_opt
- echo Processing YES option
- :contin
-
- Or:
-
- rem No default. The user must enter Y or N only.
- bu y Do you want to print the audit file
- if errorlevel 1 print audit.fil
- :contin
-
-
- DUMP FILE TO SCREEN:
-
- Key code D or D^. The file name following the key code is dumped to the
- screen. Only one screen at most is shown. Display region is from the cursor
- position to the end of the screen. Useful for building a menu system.
-
-
- DISPLAY FILE:
-
- Key code F or F^. The file name following the key code is displayed on the
- screen. Much like the DOS TYPE command, except that the screen output is
- faster.
-
-
- DISPLAY HEADER:
-
- Key code H or H^. The message following the key code is displayed centered in
- a box, after the screen has been cleared.
-
-
- DISPLAY MESSAGE:
-
- Key code M or M^. The message following the key code is displayed on the
- standard output device. This is the screen if not re-directed. The text may
- be redirected to a file or the printer if you are logging messages. Works like
- the DOS ECHO command, but displays a blank line before and after the message so
- that you don't lose the message if there already is a lot of text on the
- screen. If you specify no text, 3 blank lines are displayed.
-
-
- DISPLAY BLANK LINE:
-
- Key code B or B^. A blank line is displayed on the standard output device.
- Output may be redirected to a file or the printer. Works like the DOS ECHO
- command without parameters SHOULD have worked.
-
-
- DISPLAY DAY, DATE, AND TIME:
-
- Key code T or T^. The current day, date, and time are written on standard
- output like "Thu 06-May-1993 11:25:01.92". This is useful for logging start
- and end times of a task. For example, if you redirect the output of this
- function to a file after each backup, you can always see when your last backup
- was done:
-
- bu m Last backup done:
- type last-bak.txt
- backup ....
- bu t >last-bak.txt
-
-
- SOUND:
-
- Key code S or S^. This function is useful for signalling the end of a long
- task, or errors. Possible options are R(ed Alert), W(arble), N(oise), or
- G(lissando). Run it without options and you'll get the default sound.
-
-
- WAIT:
-
- Key code W or W^. This function allows you to pause a batch job for a given
- number of seconds, and then continue automatically. This can be used for
- displaying messages for 10 seconds, and then continuing. If a key is pressed
- during the sleep process, the wait is terminated. That way you don't have to
- wait the full 10 seconds, but continue as soon as you've finished reading the
- message.
-
-
- CLEAR SCREEN:
-
- Key code ^ or ^^. This function could replace the DOS CLS command because it
- maintains the coloured background and border (borders on CGA and VGA only). Of
- course colours are irrelevant on monochrome displays and colour monitors in BW
- mode.
-
-
- SET CURSOR:
-
- Key code _ or _^. Use as parameters ON, OFF, or BIG. ON and BIG set the
- cursor to normal and a full box respectively. OFF hides the cursor.
-
-
-
- Send your comments, suggestions, and bug reports to:
-
- Mr. Gerry J. Danen
- 106 Abbotsfield Road
- Edmonton, Alberta T5W 4S9
- CANADA
- BBS: 403/477-9545
- CompuServe: 70672,1624
- Internet: gdanen@freenet.edmonton.ab.ca